<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>登录</title>
  <link rel="stylesheet" type="text/css" href="css/main.css">
  <link rel="stylesheet" href="layui/css/layui.css" media="all">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
</head>
<style>

</style>

<body>
  <div class="content content-nav-base  login-content">
    

    <div class="login-bg" id="app">
      <div class="site-nav w1200">
        <p class="sn-back-home">
          <li>管理员</li>
        </p>
      </div>
      <div class="login-cont w1200">
        <div class="form-box">
          <ul class="layui-tab-title">
            <li class="layui-this">管理员登录</li>
          </ul>
          <form class="layui-form" action="" id="formD">
            <legend>管理员登录</legend>
            <div class="layui-form-item">
              <div class="layui-inline veri-code">
                <div class="layui-input-inline">
                  <input type="text" name="uname" id="uname" lay-verify="required" placeholder="请输入管理员账户"
                    autocomplete="off" class="layui-input">
                </div>
              </div>
              <div class="layui-inline veri-code">
                <div class="layui-input-inline">
                  <input id="pwd" type="password" name="pwd" lay-verify="required" placeholder="请输入密码"
                    autocomplete="off" class="layui-input">

                </div>
              </div>
            </div>
            <div class="layui-form-item login-btn">
              <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="demo1" id="find" onclick="return false">登录</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</body>
<script src="layui/layui.js"></script>
<script src="js/vue.js"></script>
<script type="text/javascript">
  layui.use(['jquery', 'form', 'layer'], function () {
    var $ = layui.$, form = layui.form;
    var layer = layui.layer;

    //登录
    $("#find").click(function () {
      $.ajax({
        type: "get",
        url: "admin.action",
        data: {
          'adminId': $("#uname").val(),
          'password': $("#pwd").val()
        },
        dataType: "json",//返回的
        success: function (data) {
          if (data.msg == 1) {
            layer.alert('登录成功！', { title: '登录' }, function (index) {
              layer.close(index);
              location.href = "Manager.html";
            });
          } else if (data.msg == 0) {
            layer.alert('登录失败！', { title: '登录' }, function (index) {
              layer.close(index);
              location.href = "managerLogin.html";
            });
          }
        },
        error: function (msg) {
          console.log(msg);
          layer.alert('登录失败', { title: '登录' }, function (index) {
            layer.close(index);
            location.href = "managerLogin.html";
          });
        }
      });
    })
  })
</script>


</html>